package controllers;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import applicationModels.Juego;

/**
 * Servlet implementation class LoadIndex
 */
public class LoadIndex extends SuperServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		makeGameInstance(request) ;
		String[] valueReiniciar = request.getParameterValues("reiniciar");
		
		if(valueReiniciar!=null) {
			String reiniciar = request.getParameter("reiniciar");
			if(reiniciar.equals("1")){
				restartGame(request);
			}
			
		}
		request.getRequestDispatcher("index.jsp").forward(request, response);
	}

}
